package com.yingdong.message;

import java.util.Collection;

import com.yingdong.db.Userhouse;
import com.yingdong.opcode.ServerOpcode;
import com.yingdong.sceneserver.inner.message.SendBaseMessage;

public class HouseMessage extends SendBaseMessage {

	public HouseMessage(Collection<Userhouse> map) {
		super(ServerOpcode.HOUSE);
		writeByte(map.size());
		for (Userhouse userhouse : map) {
			writeShort(userhouse.getSlotId());
			writeInt(userhouse.getItemId());
			writeInt(userhouse.getLevel());
		}
	}

	public HouseMessage(Userhouse userhouse) {
		super(ServerOpcode.HOUSE);
		writeByte(1);
		writeShort(userhouse.getSlotId());
		writeInt(userhouse.getItemId());
		writeInt(userhouse.getLevel());
	}
}
